<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        button{
            font-size: 30px;
        }
        p{
            text-align: center;
            margin-top: 250px;
            font-size: 40px;
            color: red;
        }
    </style>
</head>
<body>
    <button class="on">设置炸弹</button><br>
    <button class="off">拆除炸弹</button>
    <p></p>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script>
        let t;
        let t1;
        $('.on').click(function (e) { 
            e.preventDefault();
            $(this).attr('disabled','true');
            let i =3;
            $('p').text(i);
                t1=setInterval(function () {
                    i--
                    $('p').text(i);
                    if (i===0) {
                        clearInterval(t1);
                    }
                },1000)
            t=setTimeout(function(){
                $('p').text('炸弹爆炸了');
            },4000)
        });
        $('.off').click(function (e) { 
            e.preventDefault();
            $('.on').removeAttr('disabled');
            clearTimeout(t);
            clearInterval(t1);
            $('p').text('炸弹已被拆除');
        });
    </script>
</body>
</html>